<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>

<script>
	function dialogAjaxDone_TPL () {
		// 重新加载当前弹框页面数据
		var dialogs = $(".dialog");
		if ($.pdialog._current != null) {
			if (dialogs.length > 1) {
				$.pdialog.switchDialog($(dialogs[dialogs.length - 2]));
				$.pdialog.close($(dialogs[dialogs.length - 1]));
			} else {
				$.pdialog.closeCurrent();
			}
			
			$.pdialog.reload("app/flow/def/index.do?action=dialogFlowDefConfPage&id=${entity ne null ? entity.flowDef.id : defId}");
		}
	}
	
</script>

<div class="pageContent">
	<form method="post" action="app/flow/def/template.do?action=actionSaveFlowTemplate" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone_TPL);" id="formTemplate">
		<div class="pageFormContent" layoutH="56">
			<table cellspacing="10" cellpadding="10" class="dform">
				<tr>
					<td>节点名称：</td>
					<td><input name="nodeTitle" type="text" size="30" value="${entity ne null ? entity.nodeTitle : ''}" class="required" style="width: 88%" ${entity ne null && entity.sequence lt 3 ? 'readonly' : ''}/></td>
				</tr>
				<tr>
					<td>节点标识：</td>
					<td><input name="nodeKey" type="text" size="30" value="${entity ne null ? entity.nodeKey : ''}" class="required" style="width: 88%" ${entity ne null && entity.sequence lt 3 ? 'readonly' : ''}/></td>
				</tr>
				<tr>
					<td style="vertical-align: top;">节点描述：</td>
					<td>
						<textarea rows="2" cols="40" name="nodeDesc" class="textInput" style="width: 88%">${entity ne null ? entity.nodeDesc : ''}</textarea>
					</td>
				</tr>
				<tr>
					<td>审批角色：</td>
					<td>
						<select class="combox required" name="toAuditRoleId" id="dialog_auditRole">
							<option value="">请选择一个角色</option>
							<logic:present name="allRoles">
								<logic:iterate name="allRoles" id="role">
									<option value="${role.id}" ${entity ne null && entity.toAuditRole ne null && entity.toAuditRole.id eq role.id ? 'selected' : ''}>${role.roleName}</option>
								</logic:iterate>
							</logic:present>
						</select>
					</td>
				</tr>
				<tr>
					<td>必经节点：</td>
					<td>
						<select class="combox required" name="mandatoryFlag" id="dialog_mandatoryFlag">
							<option value="">请选择</option>
							<option value="0" ${entity ne null && entity.mandatoryFlag eq 0 ? 'selected' : ''}>否</option>
							<option value="1" ${entity ne null && entity.mandatoryFlag eq 1 ? 'selected' : ''}>是</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>需要过会：</td>
					<td>
						<select class="combox required" name="conferenceFlag" id="dialog_conferenceFlag">
							<option value="">请选择</option>
							<option value="0" ${entity ne null && entity.conferenceFlag eq 0 ? 'selected' : ''}>否</option>
							<option value="1" ${entity ne null && entity.conferenceFlag eq 1 ? 'selected' : ''}>是</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>预审环节：</td>
					<td>
						<select class="combox" name="dependedFlowId" id="dialog_conferenceNodes">
							<option value="">无</option>
							<logic:present name="conferFlows">
								<logic:iterate name="conferFlows" id="conferFlow">
									<option value="${conferFlow.id}" ${entity ne null && entity.dependedFlow ne null && entity.dependedFlow.id eq conferFlow.id ? 'selected' : ''}>${conferFlow.nodeTitle}</option>
								</logic:iterate>
							</logic:present>
						</select>
						<label style="color:#999; float: none">自动转入该预审环节, 待审核通过后才进入该审批节点...</label>
					</td>
				</tr>
			</table>
		</div>
		<div class="formBar">
			<ul>
				<li>
					<div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div>
				</li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
		<input type="hidden" name="defId" value="${entity ne null ? entity.flowDef.id : defId}" />
		<input type="hidden" name="id" value="${entity ne null ? entity.id : '-1'}" />
	</form>
<div>